const seq = require('../connections/mysql_connect'),
      { STRING, INT, DECIMAL, TEXT } = require('../../config/db_type_config');

const ProblemModel = seq.define('problem', {
  pid: {
    content: 'problem_id',
    type: INT,
    allowNull: false,
    unique: true
  },
  problemTypeId: {
    content: 'problem type id',
    type: INT,
    allowNull: false
  },
  title: {
    content: 'problem_title',
    type: STRING,
    allowNull: false
  },
  difficulty: {
    content: 'the difficulty of problem',
    type: STRING,
    allowNull: false
  },
  content: {
    content: 'the problem content',
    type: TEXT,
    allowNull: false
  },
  example: {
    content: 'the example of the problem',
    type: TEXT,
    allowNull: false
  },
  pass_times: {
    content: 'how many times with the user pass',
    type: INT,
    allowNull: true,
    defaultValue: 0
  },
  submit_times: {
    content: 'how many times with the user submit',
    type: INT,
    allowNull: true,
    defaultValue: 0
  },
  status: {
    content: 'the states with is show problem',
    type: INT,
    allowNull: true,
    defaultValue: 1
  }
})


module.exports = ProblemModel;